HDR = ./include

MODSDIR = ../bin/modules/

OBJ = ../obj/

OBJOKER = $(wildcard $(OBJ)/*.c)
# Convert $(SRC)/%.c to $(SRC)/%.o
OBJECTS2= $(OBJOKER:.o=.o)
# Convert $(SRC)/%.o to %.o
OBJECTS1= $(notdir $(OBJOKER))
# Convert %.o to $(OBJ)/%.o
OBJECTS= $(addprefix ../obj/, $(OBJECTS1))

.SUFFIXES: .c .o .so
 
all: BUILD_MODULES
 
SRC=$(wildcard *.c)
SO=$(SRC:.c=.so)
 
BUILD_MODULES : $(SO) $(OBJECTS)  

%.o: %.c
	gcc -fPIC -g -c -Wall -I$(HDR) $< -c
 
%.so: %.o
	gcc -shared -Wl,-soname,$@ -o $(MODSDIR)$@ $< ../obj/aureslib.a

depend:
	makedepend -I$(HDR) *.c
